using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using HBCode.BusinessLogic.Entities;
using HBCode.BusinessLogic.Mapping;

namespace HBCode.BusinessLogic
{
	public class EntityFContext : DbContext
	{
		static EntityFContext()
		{ 
			Database.SetInitializer<EntityFContext>(null);
		}

		public DbSet<Category> Categories { get; set; }
		public DbSet<Customer> Customers { get; set; }
		public DbSet<Product> Products { get; set; }

		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
			modelBuilder.Configurations.Add(new CategoryMap());
			modelBuilder.Configurations.Add(new CustomerMap());
			modelBuilder.Configurations.Add(new ProductMap());
		}
	}
}

